package cn.lanqiao.bigDate.mapper.sys;

import cn.lanqiao.bigDate.entity.sys.SysUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
 * @description 用户信息表Mapper
 * @author yang
 * @date 2022-03-13
 */
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select(
    "<script>select t0.* from sys_user t0 " +
    //add here if need left join
    "where 1=1" +
    "<when test='id!=null and id!=&apos;&apos; '> and t0.id=#{id}</when> " +
    "<when test='deptId!=null and deptId!=&apos;&apos; '> and t0.dept_id=#{deptId}</when> " +
    "<when test='loginName!=null and loginName!=&apos;&apos; '> and t0.login_name=#{loginName}</when> " +
    "<when test='userName!=null and userName!=&apos;&apos; '> and t0.user_name=#{userName}</when> " +
    "<when test='userType!=null and userType!=&apos;&apos; '> and t0.user_type=#{userType}</when> " +
    "<when test='email!=null and email!=&apos;&apos; '> and t0.email=#{email}</when> " +
    "<when test='phonenumber!=null and phonenumber!=&apos;&apos; '> and t0.phonenumber=#{phonenumber}</when> " +
    "<when test='sex!=null and sex!=&apos;&apos; '> and t0.sex=#{sex}</when> " +
    "<when test='avatar!=null and avatar!=&apos;&apos; '> and t0.avatar=#{avatar}</when> " +
    "<when test='password!=null and password!=&apos;&apos; '> and t0.password=#{password}</when> " +
    "<when test='salt!=null and salt!=&apos;&apos; '> and t0.salt=#{salt}</when> " +
    "<when test='status!=null and status!=&apos;&apos; '> and t0.status=#{status}</when> " +
    "<when test='delFlag!=null and delFlag!=&apos;&apos; '> and t0.del_flag=#{delFlag}</when> " +
    "<when test='loginIp!=null and loginIp!=&apos;&apos; '> and t0.login_ip=#{loginIp}</when> " +
    "<when test='loginDate!=null and loginDate!=&apos;&apos; '> and t0.login_date=#{loginDate}</when> " +
    "<when test='createBy!=null and createBy!=&apos;&apos; '> and t0.create_by=#{createBy}</when> " +
    "<when test='createTime!=null and createTime!=&apos;&apos; '> and t0.create_time=#{createTime}</when> " +
    "<when test='updateBy!=null and updateBy!=&apos;&apos; '> and t0.update_by=#{updateBy}</when> " +
    "<when test='updateTime!=null and updateTime!=&apos;&apos; '> and t0.update_time=#{updateTime}</when> " +
    "<when test='remark!=null and remark!=&apos;&apos; '> and t0.remark=#{remark}</when> " +
    //add here if need page limit
    //" limit ${page},${limit} " +
    " </script>")
    List<SysUser> pageAll(SysUser queryParamDTO,int page,int limit);

    @Select("<script>select count(1) from sys_user t0 " +
    //add here if need left join
    "where 1=1" +
    "<when test='id!=null and id!=&apos;&apos; '> and t0.id=#{id}</when> " +
    "<when test='deptId!=null and deptId!=&apos;&apos; '> and t0.dept_id=#{deptId}</when> " +
    "<when test='loginName!=null and loginName!=&apos;&apos; '> and t0.login_name=#{loginName}</when> " +
    "<when test='userName!=null and userName!=&apos;&apos; '> and t0.user_name=#{userName}</when> " +
    "<when test='userType!=null and userType!=&apos;&apos; '> and t0.user_type=#{userType}</when> " +
    "<when test='email!=null and email!=&apos;&apos; '> and t0.email=#{email}</when> " +
    "<when test='phonenumber!=null and phonenumber!=&apos;&apos; '> and t0.phonenumber=#{phonenumber}</when> " +
    "<when test='sex!=null and sex!=&apos;&apos; '> and t0.sex=#{sex}</when> " +
    "<when test='avatar!=null and avatar!=&apos;&apos; '> and t0.avatar=#{avatar}</when> " +
    "<when test='password!=null and password!=&apos;&apos; '> and t0.password=#{password}</when> " +
    "<when test='salt!=null and salt!=&apos;&apos; '> and t0.salt=#{salt}</when> " +
    "<when test='status!=null and status!=&apos;&apos; '> and t0.status=#{status}</when> " +
    "<when test='delFlag!=null and delFlag!=&apos;&apos; '> and t0.del_flag=#{delFlag}</when> " +
    "<when test='loginIp!=null and loginIp!=&apos;&apos; '> and t0.login_ip=#{loginIp}</when> " +
    "<when test='loginDate!=null and loginDate!=&apos;&apos; '> and t0.login_date=#{loginDate}</when> " +
    "<when test='createBy!=null and createBy!=&apos;&apos; '> and t0.create_by=#{createBy}</when> " +
    "<when test='createTime!=null and createTime!=&apos;&apos; '> and t0.create_time=#{createTime}</when> " +
    "<when test='updateBy!=null and updateBy!=&apos;&apos; '> and t0.update_by=#{updateBy}</when> " +
    "<when test='updateTime!=null and updateTime!=&apos;&apos; '> and t0.update_time=#{updateTime}</when> " +
    "<when test='remark!=null and remark!=&apos;&apos; '> and t0.remark=#{remark}</when> " +
     " </script>")
    int countAll(SysUser queryParamDTO);

}